]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
workspaces-view: Always update zoom on workspace changes
authorFlorian Müllner <fmuellner@gnome.org>
Tue, 21 Jun 2011 20:02:32 +0000 (22:02 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Tue, 21 Jun 2011 20:23:55 +0000 (22:23 +0200)
With commit 59a3e393f9 whether the workspace pager should autohide
now depends on the number of workspaces. As we only track changes
to the number of workspaces while the overview is visible, we miss
changes in "normal mode", i.e. when creating a new workspace by
moving a window with ctrl-alt-shift-arrow; as a result, the pager's
autohiding might be incorrect when entering the overview after that.
As a fix, keep tracking changes to the workspaces when the overview
is hidden and update the zoom options.

https://bugzilla.gnome.org/show_bug.cgi?id=653078

js/ui/workspacesView.js

index 9218a7b7d4339bece45be49643d2e9f772e9c6ed..19ec796005a2a12be2bc982bacaa3aa6d93fddaa 100644 (file)
@@ -556,6 +556,9 @@ WorkspacesDisplay.prototype = {
         this._updateAlwaysZoom();
 
         global.screen.connect('monitors-changed', Lang.bind(this, this._updateAlwaysZoom));
+        global.screen.connect('notify::n-workspaces',
+                              Lang.bind(this, this._workspacesChanged));
+
         Main.xdndHandler.connect('drag-begin', Lang.bind(this, function(){
             this._alwaysZoomOut = true;
         }));
@@ -565,7 +568,6 @@ WorkspacesDisplay.prototype = {
             this._updateAlwaysZoom();
         }));
 
-        this._nWorkspacesNotifyId = 0;
         this._switchWorkspaceNotifyId = 0;
 
         this._itemDragBeginId = 0;
@@ -595,10 +597,6 @@ WorkspacesDisplay.prototype = {
         this.workspacesView = new WorkspacesView(this._workspaces);
         this._updateWorkspacesGeometry();
 
-        this._nWorkspacesNotifyId =
-            global.screen.connect('notify::n-workspaces',
-                                  Lang.bind(this, this._workspacesChanged));
-
         this._restackedNotifyId =
             global.screen.connect('restacked',
                                   Lang.bind(this, this._onRestacked));
@@ -629,10 +627,6 @@ WorkspacesDisplay.prototype = {
         this._controls.hide();
         this._thumbnailsBox.hide();
 
-        if (this._nWorkspacesNotifyId > 0) {
-            global.screen.disconnect(this._nWorkspacesNotifyId);
-            this._nWorkspacesNotifyId = 0;
-        }
         if (this._restackedNotifyId > 0){
             global.screen.disconnect(this._restackedNotifyId);
             this._restackedNotifyId = 0;
@@ -795,6 +789,12 @@ WorkspacesDisplay.prototype = {
         if (oldNumWorkspaces == newNumWorkspaces)
             return;
 
+        this._updateAlwaysZoom();
+        this._updateZoom();
+
+        if (this.workspacesView == null)
+            return;
+
         let lostWorkspaces = [];
         if (newNumWorkspaces > oldNumWorkspaces) {
             // Assume workspaces are only added at the end
@@ -830,8 +830,6 @@ WorkspacesDisplay.prototype = {
 
         this.workspacesView.updateWorkspaces(oldNumWorkspaces,
                                              newNumWorkspaces);
-        this._updateAlwaysZoom();
-        this._updateZoom();
     },
 
     _updateZoom : function() {